﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="Tulip"
	type="http://metalx.org/Network/Dec/Tulip"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:bool="http://metalx.org/i386/Functions/Boolean"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:pcif="http://metalx.org/i386/Functions/Pci"
	xmlns:pci="http://metalx.org/Pc/Pci/Ports"
	xmlns:pcic="http://metalx.org/Pc/Pci/Command"
	xmlns:pcir="http://metalx.org/Pc/Pci/Configuration"
	xmlns:pcis="http://metalx.org/Pc/Pci/Status"
	xmlns:dc="http://metalx.org/Dec/Tulip/Registers"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:hex="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:con="http://metalx.org/i386/Functions/Console"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:imm="http://metalx.org/Intel/80386/Immediate"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands">

	<cls:field name="Device" type="http://metalx.org/Pci/PciDevice" offset="0"/>

	<cls:method name="IsNetworkCableConnected" type="http://metalx.org/Boolean">
		<cpu:CopyImmediateToAL/>
		<sbyte>-1</sbyte>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetEthernetAddress" type="http://metalx.org/Network/EthernetAddress">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress1/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToAXRegister/>
		<dc:RomManagement/>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<mm:CheckOut length="6"/>

		<cpu:PushDIToStack/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToDIAddress/>
		<int>0</int>

		<cpu:Operand16/>
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToDIAddressPlusImmediate8/>
		<byte>4</byte>
		<short>0</short>
		
		<!--Chip Reset-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004800</hex>

		<!--Chip Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Command Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 0-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 1-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 2-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 3-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 4-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 5-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Data-->
		<cpu:CopyImmediateToDX/>
		<int>0</int>

		<cpu:CopyImmediateToCX/>
		<int>16</int>

		<label id="readBit"/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:AndALWithImmediate/>
		<binary>00001000</binary>

		<cpu:ShiftRegisterByImmediateFunction8/>
		<shift:ShiftALRegisterRight/>
		<byte>3</byte>

		<cpu:Operand16/>
		<cpu:ShiftRegisterByOneFunction/>
		<shift:RollDXRegisterLeft/>

		<cpu:OrRegisterWithOperand8/>
		<op:DL-ALRegister/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:LoopToRelative8/>
		<addressOf ref="readBit" type="Relative8"/>

		<cpu:Operand16/>
		<cpu:CopyRegisterToOperand/>
		<op:DX-DIAddress/>

		<!--Chip Reset-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004800</hex>

		<!--Chip Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Command Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 0-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 1-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 2-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 3-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 4-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 5-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Data-->
		<cpu:CopyImmediateToDX/>
		<int>0</int>

		<cpu:CopyImmediateToCX/>
		<int>16</int>

		<label id="readBit2"/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:AndALWithImmediate/>
		<binary>00001000</binary>

		<cpu:ShiftRegisterByImmediateFunction8/>
		<shift:ShiftALRegisterRight/>
		<byte>3</byte>

		<cpu:Operand16/>
		<cpu:ShiftRegisterByOneFunction/>
		<shift:RollDXRegisterLeft/>

		<cpu:OrRegisterWithOperand8/>
		<op:DL-ALRegister/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:LoopToRelative8/>
		<addressOf ref="readBit2" type="Relative8"/>

		<cpu:Operand16/>
		<cpu:CopyRegisterToOperand/>
		<op:DX-DIAddressPlusImmediate8/>
		<byte>2</byte>

		<!--Chip Reset-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004800</hex>

		<!--Chip Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Command Select-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 0-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 1-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 2-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 3-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004807</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004805</hex>

		<!--Address 4-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Address 5-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<!--Data-->
		<cpu:CopyImmediateToDX/>
		<int>0</int>

		<cpu:CopyImmediateToCX/>
		<int>16</int>

		<label id="readBit3"/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004803</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:AndALWithImmediate/>
		<binary>00001000</binary>

		<cpu:ShiftRegisterByImmediateFunction8/>
		<shift:ShiftALRegisterRight/>
		<byte>3</byte>

		<cpu:Operand16/>
		<cpu:ShiftRegisterByOneFunction/>
		<shift:RollDXRegisterLeft/>

		<cpu:OrRegisterWithOperand8/>
		<op:DL-ALRegister/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004801</hex>

		<cpu:LoopToRelative8/>
		<addressOf ref="readBit3" type="Relative8"/>

		<cpu:Operand16/>
		<cpu:CopyRegisterToOperand/>
		<op:DX-DIAddressPlusImmediate8/>
		<byte>4</byte>

		<!--Chip Reset-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<hex>00004800</hex>

		<sys:GetCatalog/>

		<cpu:CopyImmediateToDI/>
		<addressOf ref="ethernetAddress" type="Absolute32"/>
		
		<cat:FindType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-BXRegister/>

		<cpu:PullDIFromStack/>

		<obj:Create/>

		<cpu:ReturnToNearCaller/>

		<var:string id="ethernetAddress">http://metalx.org/Network/EthernetAddress</var:string>
	</cls:method>

	<cls:method name="Enable" type="http://metalx.org/Network/Dec/Tulip">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress1/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<hex>48</hex>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="Disable" type="http://metalx.org/Network/Amd/PcNet">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetPacket" type="http://metalx.org/Network/EthernetPacket">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetMissedFrameCount" type="http://metalx.org/Integer">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetReceiveCollisionCount" type="http://metalx.org/Integer">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsPacketAvailable" type="http://metalx.org/Boolean">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="deviceName" type="Absolute32"/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>

		<var:string id="deviceName">Digital Semiconductor 21140A PCI Fast Ethernet LAN Controller</var:string>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class" static="true">
		<cpu:CopyRegisterToOperand/>
		<op:BX-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>